import React from "react";

type IProps = {}

type IState = {
    isHot: boolean
}

class Weather extends React.Component<IProps, IState> {


    constructor(props: IProps) {
        super(props);
        this.state = {isHot: true};
        this.changeWeather = this.changeWeather.bind(this);
    }

    changeWeather() {
        let {isHot} = this.state;
        this.setState({isHot: !isHot})
    }


    render() {
        let {isHot} = this.state;
        return (
            <>
                <p>今天天气很<span onClick={this.changeWeather}>{isHot ? "炎热" : "寒冷"}</span></p>
            </>
        );
    }
}

export default Weather;